using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[ExecuteInEditMode()]
[AddComponentMenu("GK/Sequencer/EditorView/gkSequencerEditorViewTicker")]
/// \class  gkSequencerEditorViewTicker
/// \brief 	Tick component at each sequencer GUI update
public class gkSequencerEditorViewTicker : MonoBehaviour
{
#if UNITY_EDITOR
	/// The component to tick
	public List<gkITickable> componentsToTick = new List<gkITickable>();
	
	/// \brief  Called after script loading
	void Start()
	{
		// Get all the tickables components
		foreach(MonoBehaviour rComponent in GetComponents<MonoBehaviour>())
		{
			if(rComponent is gkITickable)
			{
				componentsToTick.Add(rComponent as gkITickable);
			}
		}
	}
	
	/// \brief  Called on sequencer GUI update
	public void DisplaySequencerGUI()
	{
		foreach(gkITickable rComponent in componentsToTick)
		{
			rComponent.Tick();
		}
	}
#endif
}